python3.6.4源码安装 | 您所在的位置:网站首页 › python3 源码安装 › python3.6.4源码安装 |
开源之夏第三届火热来袭,高校学生参与赢万元奖金!>>>![]() 该脚本适合centos6和ubuntu用,关于debian可以根据脚本中的范例自己添加 微笑哥与你每天进步一点点
#!/bin/bash##Check systemcheck_sys(){ local checkType=$1 local value=$2 local release='' local systemPackage='' if [[ -f /etc/redhat-release ]]; then release="centos" systemPackage="yum" elif cat /etc/issue | grep -Eqi "debian"; then release="debian" systemPackage="apt" elif cat /etc/issue | grep -Eqi "ubuntu"; then release="ubuntu" systemPackage="apt" elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then release="centos" systemPackage="yum" elif cat /proc/version | grep -Eqi "debian"; then release="debian" systemPackage="apt" elif cat /proc/version | grep -Eqi "ubuntu"; then release="ubuntu" systemPackage="apt" elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then release="centos" systemPackage="yum" fi if [[ ${checkType} == "sysRelease" ]]; thenif [ "$value" == "$release" ]; then return 0 else return 1 fi elif [[ ${checkType} == "packageManager" ]]; thenif [ "$value" == "$systemPackage" ]; then return 0 else return 1fi fi}
# Get versiongetversion(){ if [[ -s /etc/redhat-release ]]; then grep -oE "[0-9.]+" /etc/redhat-release else grep -oE "[0-9.]+" /etc/issue fi}
pre_install(){ if check_sys packageManager yum || check_sys packageManager apt; then # Not support CentOS 5 if centosversion 5; then echo -e "$[{red}Error${plain}] Not supported CentOS 5, please change to CentOS 6+/Debian 7+/Ubuntu 12+ and try again." exit 1 fi else echo -e "[${red}Error${plain}] Your OS is not supported. please change OS to CentOS/Debian/Ubuntu and try again." exit 1 fi} local_IP=`curl -s iden`if check_sys packageManager yum; then echo "" echo "" echo "=======安装前请把yum源配好,(ctrl + c停止)=======" echo "您的系统是:`cat /etc/centos-release`" echo "您的内核是:`uname -r`" echo "您的外网publicIP是:$local_IP" #centos的设置倒计时 kk=5 echo "时间同步中,请稍候....." service ntpd start >/dev/null echo $? >/dev/null if [ $? -ne 0 ];then yum -y install ntpd && service ntpd start >/dev/null fi ntpdate time.nist.gov >/dev/null hwclock --systohc >/dev/null hwclock -w >/dev/null while [ $kk -gt 0 ];do echo -n $kk sleep 1kk=$(($kk - 1)) echo -ne "\r \r" donefi #系统判断 if check_sys packageManager apt; then echo "" echo "" echo "=======安装前请把yum源配好,(ctrl + c停止)=======" echo "您的系统是:`cat /etc/issue`" echo "您的内核是:`uname -r`" echo "您的外网publicIP是:$local_IP" #ubuntu的设置倒计时 if check_sys packageManager apt; then echo "" echo "" echo "=======安装前请把yum源配好,(ctrl + c停止)=======" echo "您的系统是:`cat /etc/issue`" echo "您的内核是:`uname -r`" echo "您的外网publicIP是:$local_IP" kk=5 echo "时间同步中,请稍候....." service ntp start >/dev/null echo $? >/dev/nullif [ $? -ne 0 ];then sudo apt install ntp || service ntp restart >/dev/nullfi sudo hwclock --systohc >/dev/null sudo hwclock -w >/dev/null while [ $kk -gt 0 ];do echo -n $kk sleep 1kk=$(($kk - 1)) echo -ne "\r \r" donefi #按任意键开始设置get_char(){ SAVEDSTTY=`stty -g` stty -echo stty raw dd if=/dev/tty bs=1 count=1 2> /dev/null stty -raw stty echo stty $SAVEDSTTY} sleep 3echo "时间同步完毕,按任意键继续...."char=`get_char` #系统确定后的执行命令if check_sys packageManager yum;then yum install -y wget readline-devel gcc* elif check_sys packageManager apt; then sudo apt-get -y update sudo apt-get -y install wget lrzsz gcc make \ libbz2-dev libsqlite3-dev python3-dev libxml2-dev libffi-dev libssl-dev zlib1g-devfi if [ ! -d /opop ];then mkdir /opopficd /opop/wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgztar -zxvf Python-3.6.4.tgz || tar -xf Python-3.6.4.tgz ./cd Python-3.6.4./configure --prefix=/usr/local/python3make && make installln -sv /usr/local/python3/bin/python3.6 /usr/bin/echo -e "\t\t#####################"echo -e "\t\t# 输入exit()可退出 #"echo -e "\t\t#####################"python3.6
欢迎加入QQ群一起讨论Linux、开源等技术 |
CopyRight 2018-2019 实验室设备网 版权所有 |